package com.ecarx.common.utils;

import android.content.Context;
import android.content.res.Resources;
import android.util.DisplayMetrics;

/**
 * @author qi.huang
 * @created in 2020/4/9 17:17
 */
public class DisplayUtils {

    public static int getWidthPixels(Context context) {
        if (context == null) {
            return 0;
        }

        Resources resources = context.getResources();
        DisplayMetrics displayMetrics = resources.getDisplayMetrics();
        return displayMetrics.widthPixels;
    }

    public static int getHeightPixels(Context context) {
        if (context == null) {
            return 0;
        }

        Resources resources = context.getResources();
        DisplayMetrics displayMetrics = resources.getDisplayMetrics();
        return displayMetrics.heightPixels;
    }
}
